﻿using System;
using System.Linq;
using ASPNETVN.PORTAL.Components.UI;
using ASPNETVN.PORTAL.Modules.ACTP.Components;

namespace ASPNETVN.PORTAL.Modules.ACTP.Controls
{
    public partial class TeamList : ModulePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack == false)
            {
                GridDataBinding();
            }
        }

        private void GridDataBinding()
        {
            using (ACTPDataContext context = new ACTPDataContext())
            {
                var query = context.v_ACTP_Teams.Where(x => x.ModuleID == this.ModuleID).OrderBy(x => x.Title);
                gvList.DataSource = query;
                gvList.DataBind();
            }
        }

        protected void btnRefresh_Click(object sender, EventArgs e)
        {
            GridDataBinding();
        }
    }
}